package org.corey.wyp.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.corey.wyp.business.PropertyManagerDelegate;
	import org.corey.wyp.model.ProperityModelLocator;
	
	public class TodayAccountItemDeleteCommand implements ICommand,IResponder
	{
		private var ids:Array;
		public function TodayAccountItemDeleteCommand()
		{
		}
		
		public function execute(event:CairngormEvent):void{
			ids=event.data;
			var pm:PropertyManagerDelegate=new PropertyManagerDelegate(this);
			pm.removeAccountItem(ids);
		}
		
		public function result(event:Object):void{
			var success:Boolean=Boolean(event.result); 
			if(success){
				Alert.show('删除成功！');
				ProperityModelLocator.getInstance().application.deleteTodayAccountItems(ids);
			}
		}
		
		public function fault(info:Object):void{
			Alert.show("fault:"+info.toString());
		}
	}
}